package com.laowang.project.system.service.impl;

import java.util.List;

import com.laowang.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.laowang.project.system.mapper.MyBannerMapper;
import com.laowang.project.system.domain.MyBanner;
import com.laowang.project.system.service.MyBannerService;

/**
 * bannerService业务层处理
 *
 * @author laowang
 * @date 2023-04-19
 */
@Service
public class MyBannerServiceImpl implements MyBannerService {
    @Autowired
    private MyBannerMapper myBannerMapper;

    /**
     * 查询banner
     *
     * @param id bannerID
     * @return banner
     */
    @Override
    public MyBanner selectMyBannerById(Integer id) {
        return myBannerMapper.selectMyBannerById(id);
    }

    /**
     * 查询banner列表
     *
     * @param myBanner banner
     * @return banner
     */
    @Override
    public List<MyBanner> selectMyBannerList(MyBanner myBanner) {
        return myBannerMapper.selectMyBannerList(myBanner);
    }

    /**
     * 新增banner
     *
     * @param myBanner banner
     * @return 结果
     */
    @Override
    public int insertMyBanner(MyBanner myBanner) {
        myBanner.setCreateTime(DateUtils.getNowDate());
        return myBannerMapper.insertMyBanner(myBanner);
    }

    /**
     * 修改banner
     *
     * @param myBanner banner
     * @return 结果
     */
    @Override
    public int updateMyBanner(MyBanner myBanner) {
        myBanner.setUpdateTime(DateUtils.getNowDate());
        return myBannerMapper.updateMyBanner(myBanner);
    }

    /**
     * 批量删除banner
     *
     * @param ids 需要删除的bannerID
     * @return 结果
     */
    @Override
    public int deleteMyBannerByIds(Integer[] ids) {
        return myBannerMapper.deleteMyBannerByIds(ids);
    }

    /**
     * 删除banner信息
     *
     * @param id bannerID
     * @return 结果
     */
    @Override
    public int deleteMyBannerById(Integer id) {
        return myBannerMapper.deleteMyBannerById(id);
    }
}
